import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 食堂信息信息 */
export interface Order {
          id: number; // ID
          orderSn?: string; // 订单号
          menuSn?: string; // 菜单编码
          checkCode?: string; // 取餐验证吗
          address?: string; // 配送地址（商户号）
          taskId: string; // 任务ID
          robotSn: string; // 机器人SN
  }

// 食堂信息 API
export const OrderApi = {
  // 查询食堂信息分页
  getOrderPage: async (params: any) => {
    return await request.get({ url: `/rbt/order/page`, params })
  },

  // 查询食堂信息详情
  getOrder: async (id: number) => {
    return await request.get({ url: `/rbt/order/get?id=` + id })
  },

  // 新增食堂信息
  createOrder: async (data: Order) => {
    return await request.post({ url: `/rbt/order/create`, data })
  },

  // 修改食堂信息
  updateOrder: async (data: Order) => {
    return await request.put({ url: `/rbt/order/update`, data })
  },

  // 删除食堂信息
  deleteOrder: async (id: number) => {
    return await request.delete({ url: `/rbt/order/delete?id=` + id })
  },

  /** 批量删除食堂信息 */
  deleteOrderList: async (ids: number[]) => {
    return await request.delete({ url: `/rbt/order/delete-list?ids=${ids.join(',')}` })
  },

  // 导出食堂信息 Excel
  exportOrder: async (params) => {
    return await request.download({ url: `/rbt/order/export-excel`, params })
  }
}